﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Crystal
{
    public partial class StatusWindow : Form
    {
        private const string _headerText = "**** Crystal Routine Status Information ****";
        private const string _oIncoming = "-->";
        private const string _wIncoming = ">>w>>";
        private const string _eIncoming = "!!!ERROR!!!->";

        public const byte TXT_ORDINARY  =  0;
        public const byte TXT_WARNING   =  1;
        public const byte TXT_ERROR     =  2;

        public StatusWindow()
        {
            InitializeComponent();
            StatusTextBox.Text = _headerText + "\n";
        }

        public void addSimpleText(string txt)
        {
            StatusTextBox.Text += txt + "\n";
        }

        public void addText(string txt)
        {
            addText(txt, TXT_ORDINARY);
        }

        public void addText(string txt, byte type)
        {
            string incoming = "";
            switch (type)
            {
                case TXT_ERROR:
                    incoming = _eIncoming;
                    break;
                case TXT_WARNING:
                    incoming = _wIncoming;
                    break;
                case TXT_ORDINARY:
                default:
                    incoming = _oIncoming;
                    break;
            }
            txt = incoming + " " + txt;
            addSimpleText(txt);
        }

        private void StatusWindow_FormClosed(object sender, FormClosedEventArgs e)
        {
        }

    }
}
